Skip to content

feat(queue): berth queue lets the operator bump, re-rank or drop a waiter - #324

Merged
T-Crypt merged 1 commit into
nextfrom
T-Crypt/queue-override
Nov 13, 2026
Merged

T-Crypt merged 1 commit into
nextfrom
T-Crypt/queue-override

Conversation

@T-Crypt

@T-Crypt T-Crypt commented Nov 13, 2026

Copy link
Copy Markdown
Owner

Why

Berth Next milestone 7b, operator override. The operator's rule is priority first, then first come first served,
"unless the operator changes it". Until now there was no way to change it. This PR adds that, and nothing about
the default order changes.

What changes

  • Broker.Queue(id, action, prio) with three actions:
    • bump sets a new bumpedN from the broker's order counter. sortQueue now orders by priority, then the
      latest bump, then arrival.
    • prio moves the waiter to batch, interactive or foreground. It refuses hold, because a hold is a pin, and it
      refuses a training, because the lock fixes its place.
    • drop refuses the waiter through lockCh, the same path the training lock uses.
  • Each change emits lease.queue_override with a reason like "priority batch -> foreground by the operator".
  • OpQueue goes through node.Queue to every card the waiter waits on (a multi-card lease shares one ID). Through
    server.queue it is reachable only on the 0600 socket. The harbor buttons come later, behind pairing.
  • berth queue [bump ID | prio ID CLASS | drop ID]. With no arguments it lists POS, ID, ENGINE, PRIORITY and
    WAITING in grant order. An older berthd answers unknown op "queue".
  • Docs: a "Reorder the queue" section in docs/leasing.md, plus the CLI list, the agent skill (the commands are
    the operator's to use, not an agent's) and the CHANGELOG.

Proof

  • TestQueueOverride (broker) starts with the queue a, bb, c. After bump bb it is bb, a, c. After prio c foreground it is c, bb, a. drop a refuses a with the operator's reason. It also checks that the three events
    name each change and that the next grant follows the new order. With the bump tiebreak removed it fails
    (after bump bb: [a bb c]).
  • TestQueueAgainstADaemon (CLI) runs a real berthd with a pinned holder and two waiters on the real socket. It
    covers the JSON and human lists, bump, drop, a refused prio ... hold, and an unknown ID.
  • proof.sh full passes.

…iter

Berth grants waiters by priority, then arrival, so many devices can send
work to one card with nobody sorting it. berth queue is for when the
operator wants a different order. With no arguments it lists the waiters
in grant order with their lease IDs. bump moves one to the front of its
priority class (a bumpedN tiebreak in sortQueue, latest bump first), prio
moves it to batch, interactive or foreground, and drop refuses it the way
the training lock does. A hold or a training cannot be changed here.

Each change is a lease.queue_override event. A new OpQueue goes through the
node to every card the waiter waits on.
@T-Crypt
T-Crypt merged commit f8ad189 into next Nov 13, 2026
4 checks passed
@T-Crypt
T-Crypt deleted the T-Crypt/queue-override branch November 13, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant